# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Oliver Sherouse <oliver DOT sherouse AT gmail DOT com>
# Contributor: David Scholl <djscholl@gmail.com> 
# Contributor: David Pretty <david.pretty@gmail.com> 

pkgname=python-rpy2
pkgver=3.5.14
pkgrel=1
pkgdesc='A very simple, yet robust, Python interface to the R Programming Language'
arch=(loong64 x86_64)
url='https://rpy2.github.io/'
license=(MPL GPL LGPL)
depends=(python-cffi python-numpy python-pytz python-tzlocal python-jinja r)
makedepends=(python-build python-installer python-setuptools python-wheel)
checkdepends=(python-pytest)
optdepends=('python-pandas: conversion between rpy and pandas')
source=(https://pypi.io/packages/source/r/rpy2/rpy2-$pkgver.tar.gz)
sha256sums=('5f46ae31d36e117be366ad4ae02493c015ac6ba59ebe3b4cd7200075332fc481')

build() {
  cd rpy2-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd rpy2-$pkgver
  PYTHONPATH="$PWD"/`echo build/lib.*` \
  pytest -v -k 'not test_POSIXct_datetime_from_timestamp' # Skip test that fails with tzlocal 5.x
}

package() {
  cd rpy2-$pkgver

  python -m installer --destdir="$pkgdir" dist/*.whl
}
